package io.mft.web.adapter.api.handler;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import io.mft.commons.function.response.kv.KVMap;
import io.mft.web.adapter.api.ApiHandler;

public class ApiProcessErrorHandler implements ApiHandler{

	@RequestMapping
	@ResponseBody
	public ResponseEntity<Object> handle(@RequestParam(required = false) Map<String, Object> param, HttpServletRequest request) {
		KVMap kv = new KVMap();
		kv.set("error_no", -1);
		kv.set("error_info", "系统API解析错误,HTTP处理异常");
		ResponseEntity<Object> responseEntity= ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(kv);
		return responseEntity;
	}
}